| Block | Date | aUSD_Karura | aUSD_Acala | aUSD_Total |
|---|---|---|---|---|
| 1216792 | 2021-12-30 | 10,290,227 | 5,817,751 | 16,107,978 |
| 1223729 | 2021-12-31 | 10,091,012 | 5,548,380 | 15,639,391 |
| 1230690 | 2022-01-01 | 10,182,105 | 5,566,857 | 15,748,962 |
| 1237666 | 2022-01-02 | 10,179,270 | 5,310,473 | 15,489,743 |
| 1244636 | 2022-01-03 | 10,093,426 | 5,279,072 | 15,372,498 |
| 1251539 | 2022-01-04 | 9,910,712 | 5,277,526 | 15,188,238 |
| 1258602 | 2022-01-05 | 9,746,031 | 5,246,518 | 14,992,549 |
| 1265574 | 2022-01-06 | 9,752,259 | 5,275,808 | 15,028,068 |
| 1272463 | 2022-01-07 | 9,661,268 | 4,348,873 | 14,010,141 |
| 1279512 | 2022-01-08 | 9,564,227 | 4,370,317 | 13,934,543 |
| 1286513 | 2022-01-09 | 9,557,633 | 4,374,946 | 13,932,579 |
| 1293438 | 2022-01-10 | 9,580,698 | 4,390,869 | 13,971,567 |
| 1300364 | 2022-01-11 | 8,927,325 | 4,373,673 | 13,300,997 |
| 1307287 | 2022-01-12 | 8,992,258 | 4,390,227 | 13,382,485 |
| 1314250 | 2022-01-13 | 9,000,353 | 4,378,522 | 13,378,876 |
| 1321145 | 2022-01-14 | 9,006,750 | 4,377,592 | 13,384,342 |
| 1327988 | 2022-01-15 | 9,010,572 | 4,373,829 | 13,384,401 |
| 1334836 | 2022-01-16 | 8,978,816 | 4,373,829 | 13,352,645 |
| 1341616 | 2022-01-17 | 8,915,504 | 4,373,829 | 13,289,333 |
| 1348556 | 2022-01-18 | 8,954,744 | 4,373,829 | 13,328,572 |
| 1355482 | 2022-01-19 | 8,949,750 | 4,373,829 | 13,323,579 |
| 1362368 | 2022-01-20 | 8,957,900 | 4,373,829 | 13,331,729 |
| 1369220 | 2022-01-21 | 7,868,068 | 4,373,829 | 12,241,897 |
| 1376066 | 2022-01-22 | 6,270,610 | 4,373,829 | 10,644,439 |
| 1382988 | 2022-01-23 | 6,350,365 | 4,373,829 | 10,724,193 |
| 1389889 | 2022-01-24 | 6,048,434 | 4,373,829 | 10,422,263 |
| 1396806 | 2022-01-25 | 5,788,839 | 4,373,829 | 10,162,667 |
| 1403696 | 2022-01-26 | 5,669,633 | 4,373,829 | 10,043,462 |
| 1410563 | 2022-01-27 | 5,508,799 | 4,373,829 | 9,882,628 |
| 1417498 | 2022-01-28 | 5,517,955 | 4,373,829 | 9,891,784 |
| 1424433 | 2022-01-29 | 5,524,636 | 4,373,829 | 9,898,465 |
| 1431336 | 2022-01-30 | 5,509,986 | 4,373,829 | 9,883,814 |
| 1438201 | 2022-01-31 | 5,440,480 | 4,373,829 | 9,814,308 |
| 1445158 | 2022-02-01 | 5,493,135 | 4,373,829 | 9,866,964 |
| 1452085 | 2022-02-02 | 5,462,363 | 4,373,829 | 9,836,192 |
| 1459034 | 2022-02-03 | 5,405,381 | 4,373,829 | 9,779,210 |
| 1465910 | 2022-02-04 | 5,466,083 | 4,373,829 | 9,839,912 |
| 1472341 | 2022-02-05 | 5,421,444 | 4,373,829 | 9,795,273 |
| 1478495 | 2022-02-06 | 5,422,051 | 4,373,829 | 9,795,880 |
| 1484572 | 2022-02-07 | 5,432,589 | 4,373,829 | 9,806,418 |
| 1489375 | 2022-02-08 | 5,330,818 | 4,373,829 | 9,704,647 |
| 1493799 | 2022-02-09 | 5,367,400 | 4,373,829 | 9,741,229 |
| 1498135 | 2022-02-10 | 5,767,842 | 4,373,829 | 10,141,671 |
| 1502412 | 2022-02-11 | 5,650,252 | 4,373,829 | 10,024,081 |
| 1506675 | 2022-02-12 | 5,646,145 | 4,373,829 | 10,019,973 |
| 1510965 | 2022-02-13 | 5,856,542 | 4,373,829 | 10,230,371 |
| 1515339 | 2022-02-14 | 5,841,993 | 4,373,829 | 10,215,822 |
| 1519779 | 2022-02-15 | 5,860,838 | 4,373,829 | 10,234,667 |
| 1524208 | 2022-02-16 | 5,821,150 | 4,373,829 | 10,194,979 |
| 1528534 | 2022-02-17 | 5,721,577 | 4,373,829 | 10,095,405 |
| 1532831 | 2022-02-18 | 5,648,546 | 4,373,829 | 10,022,374 |
| 1537082 | 2022-02-19 | 5,553,868 | 4,373,829 | 9,927,697 |
| 1541290 | 2022-02-20 | 5,281,255 | 4,373,829 | 9,655,084 |
| 1545293 | 2022-02-21 | 5,215,281 | 4,373,829 | 9,589,110 |
| 1549212 | 2022-02-22 | 5,018,519 | 4,373,829 | 9,392,348 |
| 1553133 | 2022-02-23 | 4,970,303 | 4,373,829 | 9,344,131 |
| 1557141 | 2022-02-24 | 4,643,933 | 4,373,829 | 9,017,762 |
| 1561208 | 2022-02-25 | 4,675,561 | 4,373,829 | 9,049,390 |
| 1565186 | 2022-02-26 | 4,676,162 | 4,373,829 | 9,049,991 |
| 1569198 | 2022-02-27 | 4,627,923 | 4,373,829 | 9,001,752 |
| 1573192 | 2022-02-28 | 4,673,425 | 4,373,829 | 9,047,254 |
| 1577360 | 2022-03-01 | 4,728,346 | 4,373,829 | 9,102,174 |
| 1581658 | 2022-03-02 | 4,750,544 | 4,373,829 | 9,124,373 |
| 1586008 | 2022-03-03 | 4,682,114 | 4,373,829 | 9,055,942 |
| 1590339 | 2022-03-04 | 4,617,155 | 4,373,829 | 8,990,984 |
| 1594558 | 2022-03-05 | 4,588,524 | 4,373,829 | 8,962,353 |
| 1598920 | 2022-03-06 | 4,592,027 | 4,373,829 | 8,965,856 |
| 1603233 | 2022-03-07 | 4,572,082 | 4,373,829 | 8,945,911 |
| 1607573 | 2022-03-08 | 4,570,846 | 4,373,829 | 8,944,674 |
| 1611910 | 2022-03-09 | 4,671,687 | 4,373,829 | 9,045,515 |
| 1616357 | 2022-03-10 | 4,568,758 | 4,373,829 | 8,942,587 |
| 1620876 | 2022-03-11 | 4,579,459 | 4,373,829 | 8,953,288 |
| 1625432 | 2022-03-12 | 4,581,608 | 4,373,829 | 8,955,437 |
| 1629884 | 2022-03-13 | 4,537,367 | 4,373,829 | 8,911,196 |
| 1634405 | 2022-03-14 | 4,504,974 | 4,373,829 | 8,878,803 |
| 1638930 | 2022-03-15 | 4,517,668 | 4,373,829 | 8,891,497 |
| 1643457 | 2022-03-16 | 4,550,885 | 4,373,829 | 8,924,714 |
| 1647983 | 2022-03-17 | 4,590,944 | 4,373,829 | 8,964,773 |
| 1652652 | 2022-03-18 | 4,675,263 | 4,373,829 | 9,049,092 |
| 1657396 | 2022-03-19 | 4,724,276 | 4,373,829 | 9,098,105 |
| 1662219 | 2022-03-20 | 4,750,389 | 4,373,829 | 9,124,218 |
| 1666997 | 2022-03-21 | 4,805,186 | 4,373,829 | 9,179,014 |
| 1671509 | 2022-03-22 | 4,827,630 | 4,373,829 | 9,201,459 |
| 1675850 | 2022-03-23 | 4,865,881 | 4,373,829 | 9,239,709 |
| 1680082 | 2022-03-24 | 4,857,238 | 4,373,829 | 9,231,067 |
| 1684322 | 2022-03-25 | 4,869,007 | 4,373,829 | 9,242,836 |
| 1688574 | 2022-03-26 | 4,849,235 | 4,373,829 | 9,223,064 |
| 1692713 | 2022-03-27 | 4,895,435 | 4,373,829 | 9,269,264 |
| 1696873 | 2022-03-28 | 4,930,751 | 4,373,829 | 9,304,580 |
| 1700908 | 2022-03-29 | 5,067,601 | 4,373,829 | 9,441,430 |
| 1704922 | 2022-03-30 | 5,130,914 | 4,373,829 | 9,504,743 |
| 1708906 | 2022-03-31 | 5,239,132 | 4,373,829 | 9,612,961 |
| 1712970 | 2022-04-01 | 5,202,627 | 4,373,829 | 9,576,456 |
| 1717078 | 2022-04-02 | 5,278,899 | 4,373,829 | 9,652,728 |
| 1721276 | 2022-04-03 | 5,282,403 | 4,373,829 | 9,656,232 |
| 1725277 | 2022-04-04 | 5,155,766 | 4,373,829 | 9,529,594 |
| 1729249 | 2022-04-05 | 5,172,532 | 4,373,829 | 9,546,361 |
| 1733105 | 2022-04-06 | 5,083,636 | 4,373,829 | 9,457,465 |
| 1736920 | 2022-04-07 | 5,356,936 | 4,373,829 | 9,730,765 |
| 1740728 | 2022-04-08 | 5,333,274 | 4,373,829 | 9,707,103 |
| 1744511 | 2022-04-09 | 5,305,469 | 4,373,829 | 9,679,298 |
| 1748342 | 2022-04-10 | 5,351,529 | 4,373,829 | 9,725,358 |
| 1752148 | 2022-04-11 | 5,148,440 | 4,373,829 | 9,522,268 |
| 1756009 | 2022-04-12 | 5,168,805 | 4,373,829 | 9,542,634 |
| 1759810 | 2022-04-13 | 5,166,177 | 4,373,829 | 9,540,006 |
| 1763619 | 2022-04-14 | 5,181,003 | 4,373,829 | 9,554,832 |
| 1767375 | 2022-04-15 | 5,225,609 | 4,373,829 | 9,599,437 |
| 1771087 | 2022-04-16 | 5,231,498 | 4,373,829 | 9,605,327 |
| 1774902 | 2022-04-17 | 5,221,374 | 4,373,829 | 9,595,203 |
| 1778708 | 2022-04-18 | 5,204,413 | 4,373,829 | 9,578,242 |
| 1782472 | 2022-04-19 | 5,197,599 | 4,373,829 | 9,571,428 |
| 1786343 | 2022-04-20 | 5,234,624 | 4,373,829 | 9,608,453 |
| 1790294 | 2022-04-21 | 5,315,784 | 4,373,829 | 9,689,613 |
| 1794197 | 2022-04-22 | 5,277,628 | 4,373,829 | 9,651,457 |
| 1798162 | 2022-04-23 | 5,548,256 | 4,373,829 | 9,922,085 |
| 1802115 | 2022-04-24 | 5,465,898 | 4,373,829 | 9,839,727 |
| 1806087 | 2022-04-25 | 5,464,495 | 4,373,829 | 9,838,324 |
| 1810046 | 2022-04-26 | 5,443,354 | 4,373,829 | 9,817,183 |
| 1814021 | 2022-04-27 | 5,414,557 | 4,373,829 | 9,788,386 |
| 1817974 | 2022-04-28 | 5,417,024 | 4,373,829 | 9,790,853 |
| 1821980 | 2022-04-29 | 5,401,302 | 4,373,829 | 9,775,131 |
| 1826039 | 2022-04-30 | 5,325,695 | 4,373,829 | 9,699,524 |
| 1830125 | 2022-05-01 | 5,308,806 | 4,373,829 | 9,682,635 |
| 1834044 | 2022-05-02 | 5,290,063 | 4,373,829 | 9,663,892 |
| 1837991 | 2022-05-03 | 5,289,398 | 4,373,829 | 9,663,227 |
| 1841986 | 2022-05-04 | 5,297,538 | 4,373,829 | 9,671,367 |
| 1846132 | 2022-05-05 | 5,283,745 | 4,373,829 | 9,657,574 |
| 1850190 | 2022-05-06 | 5,288,666 | 4,373,829 | 9,662,495 |
| 1854421 | 2022-05-07 | 5,234,538 | 4,373,829 | 9,608,367 |
| 1858658 | 2022-05-08 | 5,049,196 | 4,373,829 | 9,423,025 |
| 1862992 | 2022-05-09 | 4,856,056 | 4,373,829 | 9,229,885 |
| 1867957 | 2022-05-10 | 4,445,392 | 4,373,829 | 8,819,221 |
| 1873972 | 2022-05-11 | 3,975,273 | 4,373,829 | 8,349,102 |
| 1880188 | 2022-05-12 | 3,790,518 | 4,373,829 | 8,164,347 |
| 1886554 | 2022-05-13 | 3,828,842 | 4,373,829 | 8,202,671 |
| 1892961 | 2022-05-14 | 3,812,935 | 4,373,829 | 8,186,764 |
| 1899371 | 2022-05-15 | 3,856,292 | 4,373,829 | 8,230,121 |
| 1905778 | 2022-05-16 | 3,925,850 | 4,373,829 | 8,299,679 |
| 1912230 | 2022-05-17 | 3,977,072 | 4,373,829 | 8,350,901 |
| 1918591 | 2022-05-18 | 3,942,409 | 4,373,829 | 8,316,238 |
| 1924950 | 2022-05-19 | 3,999,092 | 4,373,829 | 8,372,921 |
| 1931289 | 2022-05-20 | 3,997,746 | 4,373,829 | 8,371,575 |
| 1937640 | 2022-05-21 | 4,028,271 | 4,373,829 | 8,402,100 |
| 1944002 | 2022-05-22 | 4,053,215 | 4,373,829 | 8,427,044 |
| 1950438 | 2022-05-23 | 4,092,102 | 4,373,829 | 8,465,931 |
| 1956833 | 2022-05-24 | 4,104,772 | 4,373,829 | 8,478,601 |
| 1963028 | 2022-05-25 | 4,100,411 | 4,373,829 | 8,474,240 |
| 1969604 | 2022-05-26 | 4,072,206 | 4,373,829 | 8,446,035 |
| 1975998 | 2022-05-27 | 4,055,514 | 4,373,829 | 8,429,343 |
| 1982535 | 2022-05-28 | 4,063,472 | 4,373,829 | 8,437,302 |
| 1988972 | 2022-05-29 | 4,065,723 | 4,373,829 | 8,439,552 |
| 1995443 | 2022-05-30 | 4,075,179 | 4,373,829 | 8,449,008 |
| 2001782 | 2022-05-31 | 4,196,753 | 4,373,829 | 8,570,582 |
| 2008273 | 2022-06-01 | 4,184,512 | 4,373,829 | 8,558,341 |
| 2014698 | 2022-06-02 | 4,192,668 | 4,373,829 | 8,566,497 |
| 2021059 | 2022-06-03 | 4,151,279 | 4,373,829 | 8,525,108 |
| 2027513 | 2022-06-04 | 4,154,170 | 4,373,829 | 8,527,999 |
| 2034053 | 2022-06-05 | 4,166,220 | 4,373,829 | 8,540,049 |
| 2040490 | 2022-06-06 | 4,179,423 | 4,373,829 | 8,553,252 |
| 2046816 | 2022-06-07 | 4,177,516 | 4,373,829 | 8,551,345 |
| 2053305 | 2022-06-08 | 4,178,977 | 4,373,829 | 8,552,807 |
| 2059744 | 2022-06-09 | 4,177,130 | 4,373,829 | 8,550,959 |
| 2066092 | 2022-06-10 | 4,149,014 | 4,373,829 | 8,522,843 |
| 2072325 | 2022-06-11 | 4,102,379 | 4,373,829 | 8,476,208 |
| 2078699 | 2022-06-12 | 4,004,056 | 4,373,829 | 8,377,885 |
| 2084974 | 2022-06-13 | 3,729,152 | 4,373,829 | 8,102,981 |
| 2091245 | 2022-06-14 | 3,735,276 | 4,373,829 | 8,109,106 |
| 2097549 | 2022-06-15 | 3,788,931 | 4,373,829 | 8,162,760 |
| 2103874 | 2022-06-16 | 3,784,345 | 4,373,829 | 8,158,174 |
| 2110292 | 2022-06-17 | 3,780,450 | 4,373,829 | 8,154,279 |
| 2116724 | 2022-06-18 | 3,744,797 | 4,373,829 | 8,118,627 |
| 2123104 | 2022-06-19 | 3,770,456 | 4,373,829 | 8,144,285 |
| 2129497 | 2022-06-20 | 3,773,566 | 4,373,829 | 8,147,396 |
| 2135922 | 2022-06-21 | 3,819,698 | 4,373,829 | 8,193,527 |
| 2142278 | 2022-06-22 | 3,827,112 | 4,373,829 | 8,200,941 |
| 2148575 | 2022-06-23 | 3,829,884 | 4,373,829 | 8,203,713 |
| 2155139 | 2022-06-24 | 3,832,776 | 4,373,829 | 8,206,605 |
| 2161562 | 2022-06-25 | 3,852,269 | 4,373,829 | 8,226,099 |
| 2168013 | 2022-06-26 | 3,876,004 | 4,373,829 | 8,249,833 |
| 2173904 | 2022-06-27 | 3,839,320 | 4,373,829 | 8,213,149 |
| 2179565 | 2022-06-28 | 3,806,037 | 4,373,829 | 8,179,866 |
Please click on the Source Code link at the top of the document to see the full source code. Here is a summary:
---
title: "Acala / Karura aUSD Dashboard"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: scroll
social: menu
source_code: embed
---
```{css custom1, echo=FALSE}
.dataTables_scrollBody {
max-height: 100% !important;
}
```
```{r global, include=FALSE}
library(knitr)
knitr::opts_chunk$set(
message = FALSE,
warning = FALSE,
comment = "#>"
)
library(ggplot2)
# library(dygraphs)
library(kableExtra)
library(formattable)
library(lubridate)
library(flexdashboard)
library(DT)
library(subscanr)
library(formattable)
library(ghql)
x <- GraphqlClient$new()
# Helper function to concat
`%+%` <- function(a, b) paste0(a, b)
window <- today() - as.Date("2021-12-31") + 1
# Liquidity Pool TVL ($3.72M) = totalDefiTvl = totalDexTvl + totalDexLockedTvl + homaLocked + stableCoinTvl
dex <- getDailyPools_acala_dex("karura", window) %>%
setorder(Date, pair)
dailyTVL <- dex[, max(updateAtBlock.id), by = Date] %>%
setnames("V1", "Block")
library(reticulate)
# use_python("/opt/homebrew/bin/python3.9")
```
```{python, include=FALSE}
from substrateinterface import SubstrateInterface
import pandas as pd
def getTotalIssuance(network):
if network=="Karura":
url = 'wss://karura.polkawallet.io'
token = 'KUSD'
else:
url = 'wss://acala-rpc-0.aca-api.network'
token = 'AUSD'
substrate = SubstrateInterface(url)
data = []
for block_id in r.blocks:
hash = substrate.get_block_hash(int(block_id))
ausd = substrate.query(module='Tokens',storage_function='TotalIssuance', params = [{'Token': token}], block_hash = hash)
outi = {"Block": block_id, 'aUSD': ausd.value / 10**12}
data.append(outi)
out = pd.DataFrame(data)
return out
```
```{r tvl, cache = TRUE, include=FALSE}
blocks <- dailyTVL$Block
kusd = py$getTotalIssuance("Karura")
ausd = py$getTotalIssuance("Acala")
dailyTVL <- merge(dailyTVL, kusd, by = "Block") %>%
setnames("aUSD", "aUSD_Karura")
dailyTVL <- merge(dailyTVL, ausd, by = "Block") %>%
setnames("aUSD", "aUSD_Acala")
dailyTVL[, aUSD_Total := aUSD_Karura + aUSD_Acala]
```
# aUSD {.tabset}
Row
----
### Components of Total Value Locked
```{r k_plot1}
dat <- melt(data = dailyTVL[, .(Date, aUSD_Karura, aUSD_Acala)],
id.vars = "Date",
value.name = "aUSD")
dat[, aUSD := aUSD / 1e6]
# Stacked
ggplot(dat, aes(fill=variable, y=aUSD, x=Date)) +
geom_bar(position="stack", stat="identity") +
ggtitle(label="Issuance of aUSD") +
ylab("aUSD (in millions USD)")
```
Row
----
### aUSD Issuance
```{r ausd}
knitr::kable(dailyTVL, escape = FALSE, format.args = list(big.mark = ",")) %>%
kable_styling()
```
Row
----
### Sources and Notes
Please click on the *Source Code* link at the top of the document to see the full source code. Here is a summary:
#### aUSD
- aUDS (or kUSD) obtained from the [py-substrate-interface](https://github.com/polkascan/py-substrate-interface) using function *substrate.query(module='Tokens',storage_function='TotalIssuance', params = [{'Token': 'AUSD'}], block_hash = hash)*